package com.fjj.cs.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.fjj.cs.vo.request.AddUserByScanner;
import com.fjj.cs.vo.request.PageRequestVO;
import com.fjj.cs.vo.request.ResultVo;
import com.fjj.cs.vo.request.TestVo;
import com.fjj.cs.service.TestService;
import lombok.extern.log4j.Log4j2;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/v1/test")
@Log4j2
//@CrossOrigin
public class TestController {

    @Resource
    TestService testService;

    /**
     * Linux中添加用户信息
     *
     * @param testVo
     */
    @PostMapping("/addUserByLinux")
    public void addUserByLinux(@RequestBody TestVo testVo) {
         testService.addUserByLinux(testVo);
    }


    /**
     * 添加用户到扫描仪
     */
    @PostMapping("/addUserScanner")
    public void addUserScanner(@RequestBody AddUserByScanner addUserByScanner) {
        testService.addUserScanner(addUserByScanner);
    }

    @GetMapping("/test")
    public ResultVo<IPage<TestVo>>  testVoIPage() {
        PageRequestVO pageRequestVO = new PageRequestVO();
        IPage<TestVo> testVoIPage = testService.testVoIPage(pageRequestVO);
        return ResultVo.success(testVoIPage);
    }
}
